import pymysql as pms
import json
db = pms.connect("localhost", "root", "12345678", "db_safe_logistics")

cursor = db.cursor()
cursor.execute('create table if not exists city(id int auto_increment primary key not null,cityname varchar(255));')
cursor.execute('truncate city;')
db.commit()
all_data = '{"provinces":[{"citys":[{"citysName":"石家庄市"},{"citysName":"邯郸市"},{"citysName":"唐山市"},{"citysName":"保定市"},' \
           '{"citysName":"秦皇岛市"},{"citysName":"邢台市"},{"citysName":"张家口市"},{"citysName":"承德市"},{"citysName":"沧州市"},' \
           '{"citysName":"廊坊市"},{"citysName":"衡水市"},{"citysName":"辛集市"},{"citysName":"晋州市"},{"citysName":"新乐市"},' \
           '{"citysName":"遵化市"},{"citysName":"迁安市"},{"citysName":"霸州市"},{"citysName":"三河市"},{"citysName":"定州市"},' \
           '{"citysName":"涿州市"},{"citysName":"安国市"},{"citysName":"高碑店市"},{"citysName":"泊头市"},{"citysName":"任丘市"},' \
           '{"citysName":"黄骅市"},{"citysName":"河间市"},{"citysName":"冀州市"},{"citysName":"深州市"},{"citysName":"南宫市"},' \
           '{"citysName":"沙河市"},{"citysName":"武安市"}],"provinceName":"河北省"},{"citys":[{"citysName":"太原市"},' \
           '{"citysName":"大同市"},{"citysName":"朔州市"},{"citysName":"阳泉市"},{"citysName":"长治市"},{"citysName":"晋城市"},' \
           '{"citysName":"忻州市"},{"citysName":"吕梁市"},{"citysName":"晋中市"},{"citysName":"临汾市"},{"citysName":"运城市"},' \
           '{"citysName":"古交市"},{"citysName":"潞城市"},{"citysName":"高平市"},{"citysName":"原平市"},{"citysName":"孝义市"},' \
           '{"citysName":"汾阳市"},{"citysName":"介休市"},{"citysName":"侯马市"},{"citysName":"霍州市"},{"citysName":"永济市"},' \
           '{"citysName":"河津市"}],"provinceName":"山西省"},{"citys":[{"citysName":"呼和浩特市"},{"citysName":"包头市"},' \
           '{"citysName":"乌海市"},{"citysName":"赤峰市"},{"citysName":"呼伦贝尔市"},{"citysName":"通辽市"},{"citysName":"乌兰察布市"},' \
           '{"citysName":"鄂尔多斯市"},{"citysName":"巴彦淖尔市"},{"citysName":"满洲里市"},{"citysName":"扎兰屯市"},' \
           '{"citysName":"牙克石市"},{"citysName":"根河市"},{"citysName":"额尔古纳市"},{"citysName":"乌兰浩特市"},' \
           '{"citysName":"阿尔山市"},{"citysName":"霍林郭勒市"},{"citysName":"锡林浩特市"},{"citysName":"二连浩特市"},' \
           '{"citysName":"丰镇市"}],"provinceName":"内蒙古自治区"},{"citys":[{"citysName":"沈阳市"},{"citysName":"大连市"},' \
           '{"citysName":"朝阳市"},{"citysName":"阜新市"},{"citysName":"铁岭市"},{"citysName":"抚顺市"},{"citysName":"本溪市"},' \
           '{"citysName":"辽阳市"},{"citysName":"鞍山市"},{"citysName":"丹东市"},{"citysName":"营口市"},{"citysName":"盘锦市"},' \
           '{"citysName":"锦州市"},{"citysName":"葫芦岛市"},{"citysName":"新民市"},{"citysName":"瓦房店市"},{"citysName":"庄河市"},' \
           '{"citysName":"北票市"},{"citysName":"凌源市"},{"citysName":"调兵山市"},{"citysName":"开原市"},{"citysName":"灯塔市"},' \
           '{"citysName":"海城市"},{"citysName":"凤城市"},{"citysName":"东港市"},{"citysName":"大石桥市"},{"citysName":"盖州市"},' \
           '{"citysName":"凌海市"},{"citysName":"北镇市"},{"citysName":"兴城市"}],"provinceName":"辽宁省"},{"citys":[{' \
           '"citysName":"长春市"},{"citysName":"吉林市"},{"citysName":"白城市"},{"citysName":"松原市"},{"citysName":"四平市"},' \
           '{"citysName":"辽源市"},{"citysName":"通化市"},{"citysName":"白山市"},{"citysName":"德惠市"},{"citysName":"榆树市"},' \
           '{"citysName":"磐石市"},{"citysName":"蛟河市"},{"citysName":"桦甸市"},{"citysName":"舒兰市"},{"citysName":"洮南市"},' \
           '{"citysName":"大安市"},{"citysName":"双辽市"},{"citysName":"公主岭市"},{"citysName":"梅河口市"},{"citysName":"集安市"},' \
           '{"citysName":"临江市"},{"citysName":"延吉市"},{"citysName":"图们市"},{"citysName":"敦化市"},{"citysName":"珲春市"},' \
           '{"citysName":"龙井市"},{"citysName":"和龙市"},{"citysName":"扶余市"}],"provinceName":"吉林省"},{"citys":[{' \
           '"citysName":"哈尔滨市"},{"citysName":"齐齐哈尔市"},{"citysName":"黑河市"},{"citysName":"大庆市"},{"citysName":"伊春市"},' \
           '{"citysName":"鹤岗市"},{"citysName":"佳木斯市"},{"citysName":"双鸭山市"},{"citysName":"七台河市"},{"citysName":"鸡西市"},' \
           '{"citysName":"牡丹江市"},{"citysName":"绥化市"},{"citysName":"尚志市"},{"citysName":"五常市"},{"citysName":"讷河市"},' \
           '{"citysName":"北安市"},{"citysName":"五大连池市"},{"citysName":"铁力市"},{"citysName":"同江市"},{"citysName":"富锦市"},' \
           '{"citysName":"虎林市"},{"citysName":"密山市"},{"citysName":"绥芬河市"},{"citysName":"海林市"},{"citysName":"宁安市"},' \
           '{"citysName":"安达市"},{"citysName":"肇东市"},{"citysName":"海伦市"},{"citysName":"穆棱市"},{"citysName":"东宁市"},' \
           '{"citysName":"抚远市"}],"provinceName":"黑龙江省"},{"citys":[{"citysName":"南京市"},{"citysName":"徐州市"},' \
           '{"citysName":"连云港市"},{"citysName":"宿迁市"},{"citysName":"淮安市"},{"citysName":"盐城市"},{"citysName":"扬州市"},' \
           '{"citysName":"泰州市"},{"citysName":"南通市"},{"citysName":"镇江市"},{"citysName":"常州市"},{"citysName":"无锡市"},' \
           '{"citysName":"苏州市"},{"citysName":"常熟市"},{"citysName":"张家港市"},{"citysName":"太仓市"},{"citysName":"昆山市"},' \
           '{"citysName":"江阴市"},{"citysName":"宜兴市"},{"citysName":"溧阳市"},{"citysName":"扬中市"},{"citysName":"句容市"},' \
           '{"citysName":"丹阳市"},{"citysName":"如皋市"},{"citysName":"海门市"},{"citysName":"启东市"},{"citysName":"高邮市"},' \
           '{"citysName":"仪征市"},{"citysName":"兴化市"},{"citysName":"泰兴市"},{"citysName":"靖江市"},{"citysName":"东台市"},' \
           '{"citysName":"邳州市"},{"citysName":"新沂市"}],"provinceName":"江苏省"},{"citys":[{"citysName":"杭州市"},' \
           '{"citysName":"宁波市"},{"citysName":"湖州市"},{"citysName":"嘉兴市"},{"citysName":"舟山市"},{"citysName":"绍兴市"},' \
           '{"citysName":"衢州市"},{"citysName":"金华市"},{"citysName":"台州市"},{"citysName":"温州市"},{"citysName":"丽水市"},' \
           '{"citysName":"临安市"},{"citysName":"建德市"},{"citysName":"慈溪市"},{"citysName":"余姚市"},{"citysName":"平湖市"},' \
           '{"citysName":"海宁市"},{"citysName":"桐乡市"},{"citysName":"诸暨市"},{"citysName":"嵊州市"},{"citysName":"江山市"},' \
           '{"citysName":"兰溪市"},{"citysName":"永康市"},{"citysName":"义乌市"},{"citysName":"东阳市"},{"citysName":"临海市"},' \
           '{"citysName":"温岭市"},{"citysName":"瑞安市"},{"citysName":"乐清市"},{"citysName":"龙泉市"}],"provinceName":"浙江省"},' \
           '{"citys":[{"citysName":"合肥市"},{"citysName":"芜湖市"},{"citysName":"蚌埠市"},{"citysName":"淮南市"},' \
           '{"citysName":"马鞍山市"},{"citysName":"淮北市"},{"citysName":"铜陵市"},{"citysName":"安庆市"},{"citysName":"黄山市"},' \
           '{"citysName":"滁州市"},{"citysName":"阜阳市"},{"citysName":"宿州市"},{"citysName":"六安市"},{"citysName":"亳州市"},' \
           '{"citysName":"池州市"},{"citysName":"宣城市"},{"citysName":"巢湖市"},{"citysName":"桐城市"},{"citysName":"天长市"},' \
           '{"citysName":"明光市"},{"citysName":"界首市"},{"citysName":"宁国市"}],"provinceName":"安徽省"},{"citys":[{' \
           '"citysName":"厦门市"},{"citysName":"福州市"},{"citysName":"南平市"},{"citysName":"三明市"},{"citysName":"莆田市"},' \
           '{"citysName":"泉州市"},{"citysName":"漳州市"},{"citysName":"龙岩市"},{"citysName":"宁德市"},{"citysName":"福清市"},' \
           '{"citysName":"长乐市"},{"citysName":"邵武市"},{"citysName":"武夷山市"},{"citysName":"建瓯市"},{"citysName":"永安市"},' \
           '{"citysName":"石狮市"},{"citysName":"晋江市"},{"citysName":"南安市"},{"citysName":"龙海市"},{"citysName":"漳平市"},' \
           '{"citysName":"福安市"},{"citysName":"福鼎市"}],"provinceName":"福建省"},{"citys":[{"citysName":"南昌市"},' \
           '{"citysName":"九江市"},{"citysName":"景德镇市"},{"citysName":"鹰潭市"},{"citysName":"新余市"},{"citysName":"萍乡市"},' \
           '{"citysName":"赣州市"},{"citysName":"上饶市"},{"citysName":"抚州市"},{"citysName":"宜春市"},{"citysName":"吉安市"},' \
           '{"citysName":"瑞昌市"},{"citysName":"共青城市"},{"citysName":"乐平市"},{"citysName":"瑞金市"},{"citysName":"德兴市"},' \
           '{"citysName":"丰城市"},{"citysName":"樟树市"},{"citysName":"高安市"},{"citysName":"井冈山市"},{"citysName":"贵溪市"}],' \
           '"provinceName":"江西省"},{"citys":[{"citysName":"济南市"},{"citysName":"青岛市"},{"citysName":"聊城市"},' \
           '{"citysName":"德州市"},{"citysName":"东营市"},{"citysName":"淄博市"},{"citysName":"潍坊市"},{"citysName":"烟台市"},' \
           '{"citysName":"威海市"},{"citysName":"日照市"},{"citysName":"临沂市"},{"citysName":"枣庄市"},{"citysName":"济宁市"},' \
           '{"citysName":"泰安市"},{"citysName":"莱芜市"},{"citysName":"滨州市"},{"citysName":"菏泽市"},{"citysName":"胶州市"},' \
           '{"citysName":"即墨市"},{"citysName":"平度市"},{"citysName":"莱西市"},{"citysName":"临清市"},{"citysName":"乐陵市"},' \
           '{"citysName":"禹城市"},{"citysName":"安丘市"},{"citysName":"昌邑市"},{"citysName":"高密市"},{"citysName":"青州市"},' \
           '{"citysName":"诸城市"},{"citysName":"寿光市"},{"citysName":"栖霞市"},{"citysName":"海阳市"},{"citysName":"龙口市"},' \
           '{"citysName":"莱阳市"},{"citysName":"莱州市"},{"citysName":"蓬莱市"},{"citysName":"招远市"},{"citysName":"荣成市"},' \
           '{"citysName":"乳山市"},{"citysName":"滕州市"},{"citysName":"曲阜市"},{"citysName":"邹城市"},{"citysName":"新泰市"},' \
           '{"citysName":"肥城市"}],"provinceName":"山东省"},{"citys":[{"citysName":"郑州市"},{"citysName":"开封市"},' \
           '{"citysName":"洛阳市"},{"citysName":"平顶山市"},{"citysName":"安阳市"},{"citysName":"鹤壁市"},{"citysName":"新乡市"},' \
           '{"citysName":"焦作市"},{"citysName":"濮阳市"},{"citysName":"许昌市"},{"citysName":"漯河市"},{"citysName":"三门峡市"},' \
           '{"citysName":"南阳市"},{"citysName":"商丘市"},{"citysName":"周口市"},{"citysName":"驻马店市"},{"citysName":"信阳市"},' \
           '{"citysName":"荥阳市"},{"citysName":"新郑市"},{"citysName":"登封市"},{"citysName":"新密市"},{"citysName":"偃师市"},' \
           '{"citysName":"孟州市"},{"citysName":"沁阳市"},{"citysName":"卫辉市"},{"citysName":"辉县市"},{"citysName":"林州市"},' \
           '{"citysName":"禹州市"},{"citysName":"长葛市"},{"citysName":"舞钢市"},{"citysName":"义马市"},{"citysName":"灵宝市"},' \
           '{"citysName":"项城市"},{"citysName":"巩义市"},{"citysName":"邓州市"},{"citysName":"永城市"},{"citysName":"汝州市"},' \
           '{"citysName":"济源市"}],"provinceName":"河南省"},{"citys":[{"citysName":"武汉市"},{"citysName":"十堰市"},' \
           '{"citysName":"襄阳市"},{"citysName":"荆门市"},{"citysName":"孝感市"},{"citysName":"黄冈市"},{"citysName":"鄂州市"},' \
           '{"citysName":"黄石市"},{"citysName":"咸宁市"},{"citysName":"荆州市"},{"citysName":"宜昌市"},{"citysName":"随州市"},' \
           '{"citysName":"丹江口市"},{"citysName":"老河口市"},{"citysName":"枣阳市"},{"citysName":"宜城市"},{"citysName":"钟祥市"},' \
           '{"citysName":"汉川市"},{"citysName":"应城市"},{"citysName":"安陆市"},{"citysName":"广水市"},{"citysName":"麻城市"},' \
           '{"citysName":"武穴市"},{"citysName":"大冶市"},{"citysName":"赤壁市"},{"citysName":"石首市"},{"citysName":"洪湖市"},' \
           '{"citysName":"松滋市"},{"citysName":"宜都市"},{"citysName":"枝江市"},{"citysName":"当阳市"},{"citysName":"恩施市"},' \
           '{"citysName":"利川市"},{"citysName":"仙桃市"},{"citysName":"天门市"},{"citysName":"潜江市"}],"provinceName":"湖北省"},' \
           '{"citys":[{"citysName":"长沙市"},{"citysName":"衡阳市"},{"citysName":"张家界市"},{"citysName":"常德市"},' \
           '{"citysName":"益阳市"},{"citysName":"岳阳市"},{"citysName":"株洲市"},{"citysName":"湘潭市"},{"citysName":"郴州市"},' \
           '{"citysName":"永州市"},{"citysName":"邵阳市"},{"citysName":"怀化市"},{"citysName":"娄底市"},{"citysName":"耒阳市"},' \
           '{"citysName":"常宁市"},{"citysName":"浏阳市"},{"citysName":"津市市"},{"citysName":"沅江市"},{"citysName":"汨罗市"},' \
           '{"citysName":"临湘市"},{"citysName":"醴陵市"},{"citysName":"湘乡市"},{"citysName":"韶山市"},{"citysName":"资兴市"},' \
           '{"citysName":"武冈市"},{"citysName":"洪江市"},{"citysName":"冷水江市"},{"citysName":"涟源市"},{"citysName":"吉首市"}],' \
           '"provinceName":"湖南省"},{"citys":[{"citysName":"广州市"},{"citysName":"深圳市"},{"citysName":"清远市"},' \
           '{"citysName":"韶关市"},{"citysName":"河源市"},{"citysName":"梅州市"},{"citysName":"潮州市"},{"citysName":"汕头市"},' \
           '{"citysName":"揭阳市"},{"citysName":"汕尾市"},{"citysName":"惠州市"},{"citysName":"东莞市"},{"citysName":"珠海市"},' \
           '{"citysName":"中山市"},{"citysName":"江门市"},{"citysName":"佛山市"},{"citysName":"肇庆市"},{"citysName":"云浮市"},' \
           '{"citysName":"阳江市"},{"citysName":"茂名市"},{"citysName":"湛江市"},{"citysName":"英德市"},{"citysName":"连州市"},' \
           '{"citysName":"乐昌市"},{"citysName":"南雄市"},{"citysName":"兴宁市"},{"citysName":"普宁市"},{"citysName":"陆丰市"},' \
           '{"citysName":"恩平市"},{"citysName":"台山市"},{"citysName":"开平市"},{"citysName":"鹤山市"},{"citysName":"四会市"},' \
           '{"citysName":"罗定市"},{"citysName":"阳春市"},{"citysName":"化州市"},{"citysName":"信宜市"},{"citysName":"高州市"},' \
           '{"citysName":"吴川市"},{"citysName":"廉江市"},{"citysName":"雷州市"}],"provinceName":"广东省"},{"citys":[{' \
           '"citysName":"南宁市"},{"citysName":"桂林市"},{"citysName":"柳州市"},{"citysName":"梧州市"},{"citysName":"贵港市"},' \
           '{"citysName":"玉林市"},{"citysName":"钦州市"},{"citysName":"北海市"},{"citysName":"防城港市"},{"citysName":"崇左市"},' \
           '{"citysName":"百色市"},{"citysName":"河池市"},{"citysName":"来宾市"},{"citysName":"贺州市"},{"citysName":"岑溪市"},' \
           '{"citysName":"桂平市"},{"citysName":"北流市"},{"citysName":"东兴市"},{"citysName":"凭祥市"},{"citysName":"宜州市"},' \
           '{"citysName":"合山市"},{"citysName":"靖西市"}],"provinceName":"广西壮族自治区"},{"citys":[{"citysName":"海口市"},' \
           '{"citysName":"三亚市"},{"citysName":"三沙市"},{"citysName":"儋州市"},{"citysName":"文昌市"},{"citysName":"琼海市"},' \
           '{"citysName":"万宁市"},{"citysName":"东方市"},{"citysName":"五指山市"}],"provinceName":"海南省"},{"citys":[{' \
           '"citysName":"成都市"},{"citysName":"广元市"},{"citysName":"绵阳市"},{"citysName":"德阳市"},{"citysName":"南充市"},' \
           '{"citysName":"广安市"},{"citysName":"遂宁市"},{"citysName":"内江市"},{"citysName":"乐山市"},{"citysName":"自贡市"},' \
           '{"citysName":"泸州市"},{"citysName":"宜宾市"},{"citysName":"攀枝花市"},{"citysName":"巴中市"},{"citysName":"达州市"},' \
           '{"citysName":"资阳市"},{"citysName":"眉山市"},{"citysName":"雅安市"},{"citysName":"崇州市"},{"citysName":"邛崃市"},' \
           '{"citysName":"都江堰市"},{"citysName":"彭州市"},{"citysName":"江油市"},{"citysName":"什邡市"},{"citysName":"广汉市"},' \
           '{"citysName":"绵竹市"},{"citysName":"阆中市"},{"citysName":"华蓥市"},{"citysName":"峨眉山市"},{"citysName":"万源市"},' \
           '{"citysName":"简阳市"},{"citysName":"西昌市"},{"citysName":"康定市"},{"citysName":"马尔康市"}],"provinceName":"四川省"},' \
           '{"citys":[{"citysName":"贵阳市"},{"citysName":"六盘水市"},{"citysName":"遵义市"},{"citysName":"安顺市"},' \
           '{"citysName":"毕节市"},{"citysName":"铜仁市"},{"citysName":"清镇市"},{"citysName":"赤水市"},{"citysName":"仁怀市"},' \
           '{"citysName":"凯里市"},{"citysName":"都匀市"},{"citysName":"兴义市"},{"citysName":"福泉市"}],"provinceName":"贵州省"},' \
           '{"citys":[{"citysName":"昆明市"},{"citysName":"曲靖市"},{"citysName":"玉溪市"},{"citysName":"丽江市"},' \
           '{"citysName":"昭通市"},{"citysName":"普洱市"},{"citysName":"临沧市"},{"citysName":"保山市"},{"citysName":"安宁市"},' \
           '{"citysName":"宣威市"},{"citysName":"芒市"},{"citysName":"瑞丽市"},{"citysName":"大理市"},{"citysName":"楚雄市"},' \
           '{"citysName":"个旧市"},{"citysName":"开远市"},{"citysName":"蒙自市"},{"citysName":"弥勒市"},{"citysName":"景洪市"},' \
           '{"citysName":"文山市"},{"citysName":"香格里拉市"},{"citysName":"腾冲市"}],"provinceName":"云南省"},{"citys":[{' \
           '"citysName":"西安市"},{"citysName":"延安市"},{"citysName":"铜川市"},{"citysName":"渭南市"},{"citysName":"咸阳市"},' \
           '{"citysName":"宝鸡市"},{"citysName":"汉中市"},{"citysName":"榆林市"},{"citysName":"商洛市"},{"citysName":"安康市"},' \
           '{"citysName":"韩城"},{"citysName":"华阴"},{"citysName":"兴平"}],"provinceName":"陕西省"},{"citys":[{' \
           '"citysName":"兰州市"},{"citysName":"嘉峪关市"},{"citysName":"金昌市"},{"citysName":"白银市"},{"citysName":"天水市"},' \
           '{"citysName":"酒泉市"},{"citysName":"张掖市"},{"citysName":"武威市"},{"citysName":"庆阳市"},{"citysName":"平凉市"},' \
           '{"citysName":"定西市"},{"citysName":"陇南市"},{"citysName":"玉门市"},{"citysName":"敦煌市"},{"citysName":"临夏市"},' \
           '{"citysName":"合作市"}],"provinceName":"甘肃省"},{"citys":[{"citysName":"西宁市"},{"citysName":"海东市"},' \
           '{"citysName":"格尔木市"},{"citysName":"德令哈市"},{"citysName":"玉树市"}],"provinceName":"青海省"},{"citys":[{' \
           '"citysName":"拉萨市"},{"citysName":"日喀则市"},{"citysName":"昌都市"},{"citysName":"林芝市"},{"citysName":"山南市"}],' \
           '"provinceName":"西藏自治区"},{"citys":[{"citysName":"银川市"},{"citysName":"石嘴山市"},{"citysName":"吴忠市"},' \
           '{"citysName":"中卫市"},{"citysName":"固原市"},{"citysName":"灵武市"},{"citysName":"青铜峡市"}],' \
           '"provinceName":"宁夏回族自治区"},{"citys":[{"citysName":"台北市"},{"citysName":"新北市"},{"citysName":"桃园市"},' \
           '{"citysName":"台中市"},{"citysName":"台南市"},{"citysName":"高雄市"},{"citysName":"基隆市"},{"citysName":"新竹市"},' \
           '{"citysName":"嘉义市"}],"provinceName":"台湾"},{"citys":[{"citysName":"北京市"}],"provinceName":"北京市"},' \
           '{"citys":[{"citysName":"天津市"}],"provinceName":"天津市"},{"citys":[{"citysName":"上海市"}],' \
           '"provinceName":"上海市"},{"citys":[{"citysName":"重庆市"}],"provinceName":"重庆市"},{"citys":[{' \
           '"citysName":"香港特别行政区"}],"provinceName":"香港"},{"citys":[{"citysName":"澳门特别行政区"}],"provinceName":"澳门"},' \
           '{"citys":[{"citysName":"乌鲁木齐市"},{"citysName":"克拉玛依市"},{"citysName":"吐鲁番市"},{"citysName":"哈密市"},' \
           '{"citysName":"喀什市"},{"citysName":"阿克苏市"},{"citysName":"和田市"},{"citysName":"阿图什市"},{"citysName":"阿拉山口市"},' \
           '{"citysName":"博乐市"},{"citysName":"昌吉市"},{"citysName":"阜康市"},{"citysName":"库尔勒市"},{"citysName":"伊宁市"},' \
           '{"citysName":"奎屯市"},{"citysName":"塔城市"},{"citysName":"乌苏市"},{"citysName":"阿勒泰市"},{"citysName":"霍尔果斯市"},' \
           '{"citysName":"石河子市"},{"citysName":"阿拉尔市"},{"citysName":"图木舒克市"},{"citysName":"五家渠市"},{"citysName":"北屯市"},' \
           '{"citysName":"铁门关市"},{"citysName":"双河市"},{"citysName":"可克达拉市"},{"citysName":"昆玉市"}],' \
           '"provinceName":"新疆维吾尔自治区"}]} '

data = json.loads(all_data)
# print(data)
data1 = data["provinces"]
count = 0;
for x in data1:
    # print(x)
    citys = x["citys"]
    provinceName = x["provinceName"]
    for y in citys:
        count = count + 1;
        # print(y["citysName"])
        sql = 'insert into city(id, cityname) values("%s","%s")'% (count, y["citysName"])
        cursor.execute(sql)
    count = count + 1;
    sql = "insert into city(id, cityname) values('%s','%s')" % (count, provinceName)
    cursor.execute(sql)
    db.commit()
# data2 = data1["citys"]
print("完成城市导入")
db.close();